// 爱丽丝的人偶(贪心)
#include <iostream>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int l = 1, r = n;
    while (l <= r)
    {
        cout << l++ << " ";
        if (l <= r) cout << r-- << " ";
    }
    return 0;
}

// 集合(排序)
#include <iostream>
#include <algorithm>
using namespace std;

const int N = 10001;
int a[N], b[N];

int main() 
{
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) cin >> b[i];
    sort(a, a + n);
    sort(b, b + m);
    int l = 0, r = 0;
    while (l < n && r < m)
    {
        if (a[l] < b[r]) cout << a[l++] << " ";
        else if (a[l] == b[r]) l++;
        else cout << b[r++] << " ";
    }
    while (l < n) cout << a[l++] << " ";
    while (r < m) cout << b[r++] << " ";
    return 0;
}

#include <iostream>
#include <set>
using namespace std;

int main() 
{
    int n, m;
    cin >> n >> m;
    set<int> s;
    for (int i = 0; i < n + m; i++)
    {
        int x; cin >> x;
        s.insert(x);
    }
    for (auto e : s)
        cout << e << " ";
    return 0;
}

// 最长回文子序列(动态规划)
#include <iostream>
#include <string>
using namespace std;

int dp[1001][1001];

int main()
{
    string s;
    cin >> s;
    int n = s.size();
    for (int i = n - 1; i >= 0; i--)
    {
        dp[i][i] = 1;
        for (int j = i + 1; j < n; j++)
        {
            if (s[i] == s[j]) dp[i][j] = dp[i + 1][j - 1] + 2;
            else dp[i][j] = max(dp[i + 1][j], dp[i][j - 1]);
        }
    }
    cout << dp[0][n - 1] << endl;
    return 0;
}
